Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

avoid zero division in RayCaster::setupRayCaster #418

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Naoki-Hiraoka
Copy link

@Naoki-Hiraoka Naoki-Hiraoka commented Jul 1, 2024

When I executed the following code, I got a strange result.

GlobalIndex global_voxel_idx;
RayCaster ray_caster(Point(0.0,0.0,0.0), Point(0.0,1.0,0.0), false,
                     true,
                     5.0, 1 / 0.2,
                     0.1, false);
while (ray_caster.nextRayIndex(&global_voxel_idx)) {
  std::cout << global_voxel_idx.transpose() << std::endl;
 }
# result
0 5 0
0 5 0
0 5 0
0 5 0
0 5 0
0 5 0

The expected result is

0 5 0
0 4 0
0 3 0
0 2 0
0 1 0
0 0 0

This is because there are zero divisions in RayCaster::setupRayCaster.
This Pull Request fixes this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant